package kr.hkit.summary_java.serviceui;

import javax.swing.JMenu;
import javax.swing.JMenuItem;

import org.omg.CORBA.INITIALIZE;

public class MainMenu extends JMenu {
	
	private String[] itemTitles={"추가","검색","수정","삭제","리스트"};
	private String[] menuItemTitle;
	
	public MainMenu(String title){
		super(title);
		menuItemTitle = new String[itemTitles.length];//itemTitles의 길이만큼의 배열을 선언
		for (int i = 0; i < itemTitles.length; i++) {
			menuItemTitle[i]=title+" "+itemTitles[i];					
			
		}
		initialize();
	}
	
	public MainMenu(String title, String...subTitle){
		super(title);
		menuItemTitle = new String[subTitle.length];
		for (int i = 0; i < subTitle.length; i++) {
			menuItemTitle[i]=title+" "+subTitle[i];
		}
		initialize();
	}

	private void initialize() {
		for(int i=0; i<menuItemTitle.length;i++){
		JMenuItem menuItem = new JMenuItem(menuItemTitle[i]);
		add(menuItem);
		}
	}
}
